// Fill out your copyright notice in the Description page of Project Settings.


#include "GamePS.h"
#include "Net/UnrealNetwork.h"
#include "Kismet/GameplayStatics.h"
#include "../MySQL/MySQLSubsystem.h"
#include "GameFramework/Actor.h"



AGamePS::AGamePS()
{
}

void AGamePS::BeginPlay()
{
	Super::BeginPlay();
	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString::Printf(TEXT("PS")));
}

void AGamePS::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME(AGamePS, ID);
	DOREPLIFETIME(AGamePS, Name);

}


void AGamePS::InitPlayerInfo_Implementation(int32 PlayID)
{
	ID= PlayID;
	UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(GetWorld());
	Name= GameInstance->GetSubsystem<UMySQLSubsystem>()->QueryPlayerInfoFromDB(ID).PlayerName.ToString();
	UE_LOG(LogTemp, Warning, TEXT("PS刷新完成"));
	//S2CInitPlayerInfoS2C(ID,Name);

}

bool AGamePS::InitPlayerInfo_Validate(int32 PlayID)
{
	return true;
}
